package top.bug.blog.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import top.bug.blog.entity.dto.article.*;
import top.bug.blog.entity.dto.common.BatchRequest;
import top.bug.blog.entity.dto.common.LikeRequest;
import top.bug.blog.entity.dto.common.OrderModRequest;
import top.bug.blog.entity.dto.common.SingleRequest;
import top.bug.blog.entity.po.Article;
import top.bug.blog.entity.vo.article.ArticleCardVO;
import top.bug.blog.entity.vo.article.ArticleVO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author <a href="https://github.com/jiusi66">九思.</a>
 * @email 10837907@qq.com
 * @from <a href="https://www.52bug.top">递归茶馆-www.52bug.top</a>
 * @description 文章 接口
 */
public interface ArticleService extends IService<Article> {

    /**
     * 获取文章详情
     */
    ArticleVO details(SingleRequest singleRequest);

    /**
     * 获取文章列表
     */
    Page<ArticleVO> getList(ArticleQueryRequest queryRequest);

    /**
     * 添加文章
     */
    Boolean add(ArticleAddRequest addRequest);

    /**
     * 修改文章
     */
    Boolean edit(ArticleUpdateRequest updateRequest);

    /**
     * 删除文章
     */
    Boolean delete(BatchRequest batchRequest);

    /**
     * 修改文章排序
     */
    Boolean editOrder(OrderModRequest orderModRequest);

    /**
     * 更新文章推荐状态
     */
    Boolean updateRecommend(ArticleRecommendRequest recommendRequest);

    /**
     * 发布文章
     */
    String publish(ArticlePublishRequest publishRequest);

    /**
     * 导出文章为markdown文件，并响应前端进行下载
     */
    void exportMarkdown(SingleRequest singleRequest, HttpServletResponse response);

    /**
     * 获取文章列表
     */
    Page<ArticleVO> getListByCid(ArticleQueryRequest queryRequest);

    /**
     * 获取热门文章
     */
    List<ArticleVO> getRandomList();

    /**
     * 获取推荐文章
     */
    List<ArticleVO> getRecommendList();

    /**
     * 获取时间轴文章
     */
    List<ArticleVO> getTimeLineList();

    /**
     * 文章点赞
     */
    boolean tryLike(String ip, LikeRequest likeRequest);

    /**
     * 取消点赞
     */
    boolean cancelLike(String clientIp, LikeRequest likeRequest);

    /**
     * 获取文章详情作者卡片信息
     */
    ArticleCardVO getCardInfo(SingleRequest singleRequest, HttpServletRequest request);

    /**
     * AI 自动生成摘要
     */
    String autoSummary(ArticleAutoSummaryRequest autoSummaryRequest);
}